<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script>
$(function(){
	$("#core").val("${core}");
	$("#teaching").val("${teaching}");
	if("${statu}" =="success"){
	selectMsg();
	alert("导入成功！共"+"${rowNum}"+"条数据");
	}else if("${statu}" =="error"){
	selectMsg();
	alert("导入失败！");
	}
});
var selectMsg = function(){
	var core = $("#core").val(); 
	var teaching = $("#teaching").val();
	window.location.href=encodeURI("${contextPath}/index/teaching_list.htm?core="+core+"&teaching="+teaching);
}


</script>
<script type="text/javascript">
	var checkSubmitFlg = false; 
	function upload() {
			if(checkSubmitFlg ==true){ 
				return false; //当表单被提交过一次后checkSubmitFlg将变为true,根据判断将无法进行提交。 
			} 
		var file = $("#file").val();
		   if(file == '' || file == null) {
				alert("请选择所要上传的文件！");
			} else {
				var index = file.lastIndexOf(".");
				if(index < 0) {
				alert("上传的文件格式不正确！");
					} else {
				var ext = file.substring(index + 1, file.length);
				if(ext == "xlsx" || ext == "xls") {
				checkSubmitFlg ==true; 
				return true; 
				$("#formId").submit();
					} else {
						alert("上传的文件格式不正确！");
				}}
			}
			return false;
			}
</script>




   
</head>

<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>资源统计管理</li>
			<li>&gt;</li>
			<li class="current">带教表导入</li>
		</ul>
	</div>
	<div id="container">
		<div id="title">title</div>
		<table class="form_table">
			<tr>
				<td><label><b>查询条件：</b></label> <label for="region">中心：</label>
					<input type="text" id="core" size="15" value=""/> 
					<label for="nickname">咨询账户：</label> 
					<input type="text" id="teaching" size="15" value=""/> 
					<input type="button" value=" 查 询 " onclick="selectMsg()" />
					
				<form  action="read_excel.htm"  id="formId" method="post" enctype="multipart/form-data"  onsubmit =" return  upload()">  
				<input type="file" name="file" id="file" /> 
				<input type="submit" value="导入Excel"  /></form>  
					
					
					</td>
			</tr>
		</table>
		<table>
			<tr class="fields">
				<th>中心</th>
				<th>咨询老师</th>
				<th>咨询账户</th>
				<th>带教老师</th>
				<th>带教账户</th>
			</tr>
			<#if list??>
				<#list list as list>
				<tr>
					<td align="center" class="stress">${list.core}</td>
					<td align="center">${list.teachingName}</td>
					<td align="center">${list.departments}${list.teaching}</td>
					<td align="center">${list.consultName}</td>
					<td align="center">${list.consult}</td>
				</tr>
				</#list>
			</#if>
			
		</table>
	</div>
	<div id="pager">
		<ul id="pagination">
			<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
				<#if currpage==1 >
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/index/teaching_list.htm?currPage=${currpage-1}&core=${core}&teaching=${teaching}">上一页</a></li>
					</#if>
					
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/teaching_list.htm?currPage=${index_up}&core=${core}&teaching=${teaching}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/teaching_list.htm?currPage=${index_up}&core=${core}&teaching=${teaching}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/teaching_list.htm?currPage=${pagetotal}&core=${core}&teaching=${teaching}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/teaching_list.htm?currPage=1&core=${core}&teaching=${teaching}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/teaching_list.htm?currPage=${index_up}&core=${core}&teaching=${teaching}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/teaching_list.htm?currPage=${pagetotal}&core=${core}&teaching=${teaching}">${pagetotal}</a></li>   
			<#else>\
				<li><a href="${contextPath}/index/teaching_list.htm?currPage=1&core=${core}&teaching=${teaching}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/teaching_list.htm?currPage=${index_up}&core=${core}&teaching=${teaching}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/teaching_list.htm?currPage=${currpage+1}&core=${core}&teaching=${teaching}">下一页</a></li>
		</#if>
		<li class="pageinfo">共${num}条记录</li>
		</#if>
		</ul>
	</div>
	<div class="emptyline"></div>
</body>
</html>